function error_bool($error, $field) { if($error[$field]) { print(""); } else { print(""); } } if(isset($_POST["Submit"])) { // function check_email_address function check_email_address($email) { // First, we check that there's one @ symbol, and that the lengths are right if (!ereg("^[^@]{1,64}@[^@]{1,255}$", $email)) { // Email invalid because wrong number of characters in one section, or wrong number of @ symbols. return false; } // Split it into sections to make life easier $email_array = explode("@", $email); $local_array = explode(".", $email_array[0]); for ($i = 0; $i < sizeof($local_array); $i++) { if (!ereg("^(([A-Za-z0-9!#$%&'*+/=?^_`{|}~-][A-Za-z0-9!#$%&'*+/=?^_`{|}~\.-]{0,63})|(\"[^(\\|\")]{0,62}\"))$", $local_array[$i])) { return false; } } if (!ereg("^\[?[0-9\.]+\]?$", $email_array[1])) { // Check if domain is IP. If not, it should be valid domain name $domain_array = explode(".", $email_array[1]); if (sizeof($domain_array) < 2) { return false; // Not enough parts to domain } for ($i = 0; $i < sizeof($domain_array); $i++) { if (!ereg("^(([A-Za-z0-9][A-Za-z0-9-]{0,61}[A-Za-z0-9])|([A-Za-z0-9]+))$", $domain_array[$i])) { return false; } } } return true; } //-- SPAM URL CHECK --> Kijken of er een url is GEPOST! $http_counter = 0; foreach($_POST as $key => $val){ if(stristr($val, 'http://')){ $http_counter++; } if(stristr($val, '[url=')){ $http_counter++; } } // ER IS SPAM GEPOST! if($http_counter > 0){ $captcha = ' Verificatie code '; $spam = "Viezespammert"; } if($_POST["spam"]=="Viezespammert"){ // er is al een keer spam gepost, dus nu blijven we de captcha checken. $error['norobot'] = false; if (md5($_POST['norobot']) != $_SESSION['randomnr2']) { $error['norobot'] = true; unset($norobot); $print_again = true; $message.="CODE is niet (goed) ingevuld
"; //$message.="post:".$_POST['norobot']."
session: ". $_SESSION['randomnr2'] . "
"; } $captcha = ' Verificatie code '; } $error['bedrijfsnaam'] = false; $message_bedrijfsnaam = ""; if($_POST["bedrijfsnaam"]=="") { $error['bedrijfsnaam'] = true; $print_again = true; $message_bedrijfsnaam="Bedrijfsnaam is niet ingevuld"; } if(stristr($_POST["bedrijfsnaam"], 'http://')){ $error['bedrijfsnaam'] = true; $print_again = true; $message_bedrijfsnaam="Url niet toegestaan!"; } if(stristr($_POST["bedrijfsnaam"], '[url=')){ $error['bedrijfsnaam'] = true; $print_again = true; $message_bedrijfsnaam="Url niet toegestaan!"; } $error['adres'] = false; if($_POST["adres"]=="") { $error['adres'] = true; $print_again = true; $message_adres="Adres is niet ingevuld"; } if(stristr($_POST["adres"], 'http://')){ $error['adres'] = true; $print_again = true; $message_adres="Url niet toegestaan!"; } if(stristr($$_POST["adres"], '[url=')){ $error['adres'] = true; $print_again = true; $message_adres="Url niet toegestaan!"; } $error['postcode'] = false; if($_POST["postcode"]=="") { $error['postcode'] = true; $print_again = true; $message_postcode="Postcode is niet ingevuld"; } if(stristr($_POST["postcode"], 'http://')){ $error['postcode'] = true; $print_again = true; $message_postcode="Url niet toegestaan!"; } if(stristr($_POST["postcode"], '[url=')){ $error['postcode'] = true; $print_again = true; $message_postcode="Url niet toegestaan!"; } $error['woonplaats'] = false; if($_POST["woonplaats"]=="") { $error['woonplaats'] = true; $print_again = true; $message_woonplaats="Woonplaats is niet ingevuld"; } if(stristr($_POST["woonplaats"], 'http://')){ $error['woonplaats'] = true; $print_again = true; $message_woonplaats="Url niet toegestaan!"; } if(stristr($_POST["woonplaats"], '[url=')){ $error['woonplaats'] = true; $print_again = true; $message_woonplaats="Url niet toegestaan!"; } $error['geslacht'] = false; if($_POST["geslacht"]=="") { $error['geslacht'] = true; $print_again = true; $message_geslacht="Dhr / Mevr. is niet ingevuld"; } // geen check op url nodig? $error['cp_voorletters'] = false; if($_POST["cp_voorletters"]=="") { $error['cp_voorletters'] = true; $print_again = true; $message_cp_voorletters="Voorletters zijn niet ingevuld"; } if(stristr($_POST["cp_voorletters"], 'http://')){ $error['cp_voorletters'] = true; $print_again = true; $message_cp_voorletters="Url niet toegestaan!"; } if(stristr($_POST["cp_voorletters"], '[url=')){ $error['cp_voorletters'] = true; $print_again = true; $message_cp_voorletters="Url niet toegestaan!"; } $error['cp_achternaam'] = false; if($_POST["cp_achternaam"]=="") { $error['cp_achternaam'] = true; $print_again = true; $message_cp_achternaam="Achternaam is niet ingevuld"; } if(stristr($_POST["cp_achternaam"], 'http://')){ $error['cp_achternaam'] = true; $print_again = true; $message_cp_achternaam="Url niet toegestaan!"; } if(stristr($_POST["cp_achternaam"], '[url=')){ $error['cp_achternaam'] = true; $print_again = true; $message_cp_achternaam="Url niet toegestaan!"; } $error['cp_functie'] = false; if($_POST["cp_functie"]=="") { $error['cp_functie'] = true; $print_again = true; $message_cp_functie="Functie is niet ingevuld"; } if(stristr($_POST["cp_functie"], 'http://')){ $error['cp_functie'] = true; $print_again = true; $message_cp_functie="Url niet toegestaan!"; } if(stristr($_POST["cp_functie"], '[url=')){ $error['cp_functie'] = true; $print_again = true; $message_cp_functie="Url niet toegestaan!"; } $error['telefoon'] = false; if($_POST["telefoon"]=="") { $error['telefoon'] = true; $print_again = true; $message_telefoon="Telefoon is niet ingevuld"; } if(stristr($_POST["telefoon"], 'http://')){ $error['telefoon'] = true; $print_again = true; $message_telefoon="Url niet toegestaan!"; } if(stristr($_POST["telefoon"], '[url=')){ $error['telefoon'] = true; $print_again = true; $message_telefoon="Url niet toegestaan!"; } if(!check_email_address($_POST['email'])) { $error['email'] = true; $print_again = true; $message_email="Email is niet (goed) ingevuld"; } if(stristr($_POST["email"], 'http://')){ $error['email'] = true; $print_again = true; $message_email="Url niet toegestaan!"; } if(stristr($_POST["email"], '[url=')){ $error['email'] = true; $print_again = true; $message_email="Url niet toegestaan!"; } $error['branche'] = false; if($_POST["branche"]=="") { $error['branche'] = true; $print_again = true; $message_branche="Branche is niet ingevuld"; } // geen url check op branche? $error['gebruikers'] = false; if($_POST["gebruikers"]=="") { $error['gebruikers'] = true; $print_again = true; $message_gebruikers="Aantal gebruikers is niet ingevuld"; } if(stristr($_POST["gebruikers"], 'http://')){ $error['gebruikers'] = true; $print_again = true; $message_gebruikers="Url niet toegestaan!"; } if(stristr($_POST["gebruikers"], '[url=')){ $error['gebruikers'] = true; $print_again = true; $message_gebruikers="Url niet toegestaan!"; } $error['vragen'] = false; if(stristr($_POST["vragen"], 'http://')){ $error['vragen'] = true; $print_again = true; $message_vragen="Url niet toegestaan!"; } if(stristr($_POST["vargen"], '[url=')){ $error['vragen'] = true; $print_again = true; $message_vragen="Url niet toegestaan!"; } // -- if($print_again) { $alert = 'onload="alert(\'U heeft niet alle gegevens juist ingevuld.\nVul of wijzig de rood gemarkeerde gegevens aub en klik opnieuw op verstuur.\')"'; $melding = "
Uw aanvraag is nog niet verzonden!
Wijzig a.u.b. de rood gemarkeerde velden en druk opnieuw op verstuur.
"; } else { // BRON $bron = 21; $aid = $_GET["aid"]; // Eerst gegevens aanvrager invoeren in db tabel aanvraaggegevens --> id ophalen // INSERT $sql = "insert into aanvraaggegevens ( soort, bron, vestiging, bedrijfsnaam, adres, postcode, woonplaats, cp_geslacht, cp_voorletters, cp_achternaam, cp_functie, telefoon, email, branche, gebruikers, vragen, httpref, ref, keywords ) values ('".$_POST["soort"]."', '".$bron."', '1','".$_POST["bedrijfsnaam"]."','".$_POST["adres"]."','".$_POST["postcode"]."','".$_POST["woonplaats"]."','".$_POST["geslacht"]."','".$_POST["cp_voorletters"]."','".$_POST["cp_achternaam"]."','".$_POST["cp_functie"]."','".$_POST["telefoon"]."','".$_POST["email"]."','".$_POST["branche"]."','".$_POST["gebruikers"]."','".$_POST["vragen"]."','".$_COOKIE["httprefcookie"]."','".$_COOKIE["refcookie"]."','".$_COOKIE["keywordcookie"]."')"; //echo $sql; $result = mysql_query($sql); // Er is een nieuwe pagina toegevoegd // MySQL heeft daarom zelf een nieuw pagina_id gegenereerd (met AUTO_INCREMENT) // De functie mysql_insert_id() geeft deze nieuwe waarde terug aan ons script $id = mysql_insert_id(); echo mysql_error(); // INSERT $sql = "insert into aanvragen (aanvraag_id, 2ha_id) values ('".$id."','".$aid."')"; $result = mysql_query($sql); echo mysql_error(); ///---- /// Hier de mail aan Capriole $sql = "SELECT * FROM aanvraaggegevens WHERE id = $id"; //echo $sql; $result = mysql_query($sql); echo mysql_error(); $data = mysql_fetch_array($result); /// // lijstje genereren $sql2 = "SELECT * FROM aanvragen WHERE aanvraag_id = $id"; //echo $sql; $result2 = mysql_query($sql2); echo mysql_error(); $data2 = mysql_fetch_array($result2); // lijstje genereren $machine_id = $data2["2ha_id"]; $sql3 = "SELECT contractnummer FROM tweedehandsautomaten WHERE aid = $machine_id"; //echo $sql; $result3 = mysql_query($sql3); echo mysql_error(); $data3 = mysql_fetch_array($result3); $machine = $data3["contractnummer"]; /// $bericht = '
'.$data["bedrijfsnaam"].'
'.$data["adres"].'
'.$data["postcode"].'
'.$data["woonplaats"].'
'.$data["telefoon"].'
' .'
'.$data["email"].'
'.'
'.$data["cp_geslacht"].' '.$data["cp_voorletters"].' '.$data["cp_achternaam"].'
'.$data["cp_functie"].'
'.$data["gebruikers"].'
'.$data["branche"].'
'.'
'.$data["soort"].'
'.$machine.'
'.'
'.$data["vragen"].'
'; /// //$aan = "pieter.vermeijden@capriole.nl"; $aan = "postmaster@capriole.nl"; $onderwerp = "Aanvraag Tweedehandsautomaten.be: " . $data["bedrijfsnaam"] . " | " . $data["woonplaats"]; // Kijken om welk besturingsysteem het gaat if (strtoupper(substr(PHP_OS,0,3)=='WIN')){ $eol = "\r\n"; } elseif (strtoupper(substr(PHP_OS,0,3)=='MAC')){ $eol = "\r"; } else { $eol = "\n"; } $headers  = 'MIME-Version: 1.0' . $eol; $headers .= 'Content-type: text/html; charset=iso-8859-1' . $eol; $headers .= 'From: '.$data["bedrijfsnaam"].'<'.$data["email"].'>' . $eol; mail($aan,$onderwerp,$bericht,$headers); // ----- // Hier de bevestigingsmail aan de klant $bericht = '
Beste '.$data["cp_geslacht"].' '.$data["cp_voorletters"].' '.$data["cp_achternaam"].',

Bedankt voor uw informatie aanvraag.
Een van onze medewerkers zal spoedig contact met u opnemen.

Met vriendelijke groet,

Tweedehandsautomaten.be
Vekestraat 46
1910 Kampenhout
T: (016) 53 37 56
F: (016) 56 07 92
E: info@tweedehandsautomaten.be

'; /// $aan = $data['email']; $onderwerp = "Bevestiging aanvraag op tweedehandsautomaten.be"; // Kijken om welk besturingsysteem het gaat if (strtoupper(substr(PHP_OS,0,3)=='WIN')){ $eol = "\r\n"; } elseif (strtoupper(substr(PHP_OS,0,3)=='MAC')){ $eol = "\r"; } else { $eol = "\n"; } $headers  = 'MIME-Version: 1.0' . $eol; $headers .= 'Content-type: text/html; charset=iso-8859-1' . $eol; $headers .= 'From: tweedehandsautomaten.be' . $eol; mail($aan,$onderwerp,$bericht,$headers); // ----- //// einde thanx2 script header("Location: aanvraag_thanx.php"); exit(); } } // Eerst moeten we bepalen wat de mid is van het systeem waar de gebruiker informatie over wil ontvangen. // De aid is verstuurd via de specificaties link van de desbetreffende automaat op de assortiments pagina. // aid is doorgegeven via de url $aid = $_GET["aid"]; // systeeminfo ophalen mysql_connect("localhost","pieter", "curly"); // Selecteer dan een database ---> DB KOFFIEAUTOMAAT.NL mysql_select_db("db_koffieautomaat"); // lijstje genereren $sql = "select * from tweedehandsautomaten WHERE aid = $aid"; //echo $sql; $result = mysql_query($sql); echo mysql_error(); $rij = mysql_fetch_array($result); //ACTIEPRIJS $occasionprijs = $rij["occassionprijs"]; $actieprijs = ($occasionprijs / 100) * 80; $actieprijsformat = number_format($actieprijs, 2, ',', '.'); if ($rij["herkomst"] == "occasion") { $tab = "beeld/occasiontab.gif"; $herkomstprijs = "Occasionprijs"; } if ($rij["herkomst"] == "demo") { $tab = "beeld/demotab.gif"; $herkomstprijs = "Demoprijs"; } // Als een machine verkocht is, laat dan de normale- en de occassionprijs niet meer zien. if ($rij["status"] == "verkocht") { $occas = "----"; $normaal = "----"; $actieprijsformat = "----"; } else{ $occas = $rij["occassionprijs"] . ",00"; $normaal = $rij["normaleprijs"]; $actieprijsformat = $actieprijsformat; } // Kijken of een machine te koop is of niet; bepaal dan of de knop 'bestel' zichtbaar is of niet if ($rij["status"] == "tekoop") { $tekoop = ''; } else { $tekoop = ''; } // Plaatje uit DB koffieautomaat $systeem = $rij['systeemtype']; // lijstje genereren $sql = "select * from machine where id = $systeem"; //echo $sql; $result2 = mysql_query($sql); echo mysql_error(); $data = mysql_fetch_array($result2); $systeeminfo = 'Specificaties '.$data['naam'] .''; $naam = $data['naam']; ?> TweedehandsAutomaten.nl occasion en demo modellen >
 
terug naar assortimentsoverzicht
 
GESELECTEERD SYSTEEM :

Normale prijs  
Occasionprijs
   
Contractnummer
Tellerstand
Conditie
Bijzonderheden

' ?>


Bedrijfsgegevens